using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using motion10.SharePoint.TwitterSupport.Common;

namespace motion10.SharePoint.TwitterSupport.Features
{
    /// <summary>
    /// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
    /// </summary>
    /// <remarks>
    /// The GUID attached to this class may be used during packaging and should not be modified.
    /// </remarks>

    [Guid("abeb7193-4739-4561-836d-3d48aa93bebf")]
    public class ConsumerKeysEventReceiver : SPFeatureReceiver
    {

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            TwitterConsumerKeys keys = TwitterConsumerKeys.Local;
            keys.ConsumerKeyName = properties.Feature.Properties["ConsumerKey"].Value;
            keys.ConsumerSecretName = properties.Feature.Properties["ConsumerSecret"].Value;
            keys.Update();
        }

    }
}
